package com.bestbuy.pojo;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * @author ThanhNgo
 *
 */
@Entity
@Table(name = "cart_detail")
public class CartDetail {
	@Id
	@Column(name = "IDCARTDETAIL")
	@GeneratedValue
    private Integer idcartdetail;
	
	@ManyToOne
    @JoinColumn(name="IDPRODUCT")
	@Fetch(FetchMode.JOIN)
    private Product product;
    
	@ManyToOne
    @JoinColumn(name="IDCART")
	@Fetch(FetchMode.JOIN)
    private Cart cart;
    
    @Column(name = "QUANTITY")
    private Integer quantity;
    
    @Column(name = "ISDETELED")
    private Integer isdeteled;

	public CartDetail() {
		super();
		// TODO Auto-generated constructor stub
	}

	public CartDetail(Integer idcartdetail, Product product, Cart cart,
			Integer quantity, Integer isdeteled) {
		super();
		this.idcartdetail = idcartdetail;
		this.product = product;
		this.cart = cart;
		this.quantity = quantity;
		this.isdeteled = isdeteled;
	}

	public Integer getIdcartdetail() {
		return idcartdetail;
	}

	public void setIdcartdetail(Integer idcartdetail) {
		this.idcartdetail = idcartdetail;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Cart getCart() {
		return cart;
	}

	public void setCart(Cart cart) {
		this.cart = cart;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public Integer getIsdeteled() {
		return isdeteled;
	}

	public void setIsdeteled(Integer isdeteled) {
		this.isdeteled = isdeteled;
	}
    
    
}
